//
//  MessageDetailInfoViewController.m
//  HuLaQuan
//
//  Created by hok on 1/15/16.
//  Copyright © 2016 Jianghao. All rights reserved.
//

#import "MessageDetailInfoViewController.h"


@interface MessageDetailInfoViewController ()
@property (weak, nonatomic) IBOutlet UIView *scrollView;

@property (strong, nonatomic) IBOutlet UILabel *messageTitle;

@property (strong, nonatomic) IBOutlet UILabel *messageTime;

@property (strong, nonatomic) IBOutlet UIImageView *messageImage;

@property (strong, nonatomic) IBOutlet UILabel *messageContent;
@end

@implementation MessageDetailInfoViewController

-(void)setupUI
{
  self.title = @"消息";
    [self setupNavBackButton];
    
    //获取数据
//    self.messageTitle.text = self.model.messageTitle;
//    self.messageTitle.text = @"heheh";
    
//    self.messageTime.text = [NSString stringWithFormat:@"发布时间:%@",self.model.messageTime];
    //[_messageTime sizeToFit];
//    self.messageImage.image = [UIImage imageNamed:self.model.messageImage];
//    self.messageContent.text = self.model.messageContent;
    
//    self.messageContent.text = @"heheh";
    
    //设置label内容宽度
        CGFloat textWidth = 414;
    //创建NSMutableAttributedString实例，并将text传入
        NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc]initWithString:self.messageTitle.text];
        //创建NSMutableParagraphStyle实例
        NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc]init];
        //设置行距
        [style setLineSpacing:10.0f];
    
        //判断内容长度是否大于Label内容宽度，如果不大于，则设置内容宽度为行宽（内容如果小于行宽，Label长度太短，如果Label有背景颜色，将影响布局效果）
        NSInteger leng = textWidth;
        if (attStr.length < textWidth) {
            leng = attStr.length;
        }
        //根据给定长度与style设置attStr式样
        [attStr addAttribute:NSParagraphStyleAttributeName value:style range:NSMakeRange(0, leng)];
        //Label获取attStr式样
//        self.messageContent.attributedText = attStr;
    
}

@end
